<h1>Listing users</h1>

<table>
  <tr>
		<th>username</th>
		<th>first name</th>
		<th>last name</th>
		<th>rights</th>
		<th>group</th>
  </tr>
  
<% for user in @users %>
  <tr>
		<td><%=h user.login if !user.login.nil? %></td>
		<td><%=h user.first_name if !user.first_name.nil? %></td>
		<td><%=h user.last_name if !user.last_name.nil? %></td>
		<td><%=h user.rights if !user.rights.nil? %></td>
		<td><%=h user.group.name if !user.group.nil? %></td>
    <td><%= link_to 'Show', :action => 'show', :id => user %></td>
    <td><%= link_to 'Edit', :action => 'edit', :id => user %></td>
    <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td>
  </tr>
<% end %>
</table>

<%= link_to 'Previous page', { :page => @user_pages.current.previous } if @user_pages.current.previous %>
<%= link_to 'Next page', { :page => @user_pages.current.next } if @user_pages.current.next %> 

<br />

<%= link_to 'New user', :action => 'new' %>
